package com.itheima.tliaswebmanagement.service.Impl;

import com.itheima.tliaswebmanagement.mapper.EmpMapper;
import com.itheima.tliaswebmanagement.pojo.vo.JobCountVO;
import com.itheima.tliaswebmanagement.pojo.vo.JobOptionVO;
import com.itheima.tliaswebmanagement.service.ReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @Description ReportServiceImpl
 * @Author ziguan ling
 * @Date 2025--01--09
 */
@Service
public class ReportServiceImpl implements ReportService {

    @Autowired
    private EmpMapper empMapper;
    @Override
    public JobOptionVO empJobData() {
        List<JobCountVO> result  = empMapper.empJobData();

        List jobList = new ArrayList();
        List dataList = new ArrayList();

        result.forEach(item -> {
            jobList.add(item.getJobName());
            dataList.add(item.getCount());

        });

        return new JobOptionVO(jobList,dataList);
    }

    @Override
    public List<Map> empGenderData_s() {
        List<Map> result_empGender = empMapper.empGenderData_d();
        return result_empGender;
    }

    @Override
    public List<Map> studentDegreeData_s() {
        List<Map> result_studentDegree = empMapper.studentDegreeData_d();
        return result_studentDegree;
    }
}
